<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改安全代码')" />
    <th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-role-edit" th:object="${SafetyInstruction}">
        <!--<input id="routeId" name="routeId" type="hidden" th:field="*{routeId}"/>-->
        <div class="form-group">
            <label class="col-sm-3 control-label ">安全代码：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" disabled name="hazardCode" id="hazardCode" th:field="*{hazardCode}" required  >
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">安全描述：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="description" id="description" th:field="*{description}" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">安全指导：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="noteText" id="noteText" th:field="*{noteText}" required>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: ztree-js" />
<script type="text/javascript">
//    $("#form-role-add").validate({
//        rules:{
//            onkeyup: false,
//            routeId:{
//                remote: {
//                    url: ctx + "goodsPath/checkRouteId",
//                    type: "post",
//                    dataType: "json",
//                    data: {
//                        "routeId" : function() {
//                            return $.common.trim($("#routeId").val());
//                        }
//                    },
//                    dataFilter: function(data, type) {
//                        return $.validate.unique(data);
//                    }
//                }
//            },
//        },
//        messages: {
//            "routeId": {
//                remote: "工艺路线标识已经存在"
//            }
//        },
//        focusCleanup: true
//    });
    function submitHandler() {
//        if ($.validate.form()) {
            edit();
//        }
    }

    function edit() {
        var hazardCode = $("input[name='hazardCode']").val();
        var description = $("input[name='description']").val();
        var noteText = $("input[name='noteText']").val();
        $.ajax({
            cache : true,
            type : "POST",
            url : ctx + "erp/safety/edit",
            data : {
                "hazardCode": hazardCode,
                "description": description,
                "noteText": noteText,
            },
            async : false,
            error : function(request) {
                $.modal.alertError("系统错误");
            },
            success : function(data) {
                $.operate.successCallback(data);
            }
        });
    }
</script>
</body>
</html>
